﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace NewRen.Models
{
    public class Admin
    {
        /// <summary>
        /// 逻辑ID
        /// </summary>
        public int ID { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        [Index]
        [StringLength(50)]
        public string UserName { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; }

        /// <summary>
        /// 真实姓名
        /// </summary>
        [Index]
        [StringLength(50)]
        public string RealName { get; set; }

        /// <summary>
        /// 角色int
        /// </summary>
        public int RoleAsInt { set; get; }

        [NotMapped]
        public AdminRole Role
        {
            get { return (AdminRole)RoleAsInt; }
            set { RoleAsInt = (int)Role; }
        }

        /// <summary>
        /// 图片
        /// </summary>
        public byte[] Picture { set; get; }

        /// <summary>
        /// QQ
        /// </summary>
        public string QQ { get; set; }

        /// <summary>
        /// 电话
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        public string Address { set; get; }

        /// <summary>
        /// 增加时间
        /// </summary>
        [Index]

        public DateTime Time { set; get; }
    }

    public enum AdminRole { Admin, Manager, System }

}